<template>
  <div class="sub" @click="onCityClick(cityInfo)">
    <span class="sub-city">{{cityInfo.cityName}}</span>
  </div>
</template>

<script>
  import {
    mapMutations
  } from 'vuex';

  export default {
    name: 'Sub',
    props: {
      cityInfo: Object
    },

    methods: {
      ...mapMutations(['selectCity']),
      onCityClick(cityInfo) {
        this.selectCity(cityInfo);
        this.$router.go(-1);
      }
    }
  }
</script>

<style lang="scss" scoped="scoped">
  @import '~styles/mixins.scss';
  @import '~styles/variables.scss';

  .sub {
    padding-left: .16rem;
    width: 100%;
    height: .5rem;
    background-color: #FFFFFF;
    border-bottom: 1px solid #DDDDDD;

    .sub-city {
      font-size: .16rem;
      vertical-align: -.07rem;
    }
  }
</style>
